/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.coopeud.vista.consultas;

/**
 *
 * @author Alejo
 */
public class VentanaSeleccionarEvento extends javax.swing.JFrame {

    private VentanaConsultas consulta;
    private VentanaConsultarEvento conEvento;
    private VentanaEstadísticas conEstadisticas;
    private String vent;
    
    public VentanaSeleccionarEvento() {
        super("Seleccionar Evento");
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblUno = new javax.swing.JLabel();
        cbxEvento = new javax.swing.JComboBox();
        btnSelEvento = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        lblUno.setText("Seleccione el Evento");

        btnSelEvento.setText("Seleccionar");
        btnSelEvento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSelEventoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblUno, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cbxEvento, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(189, 189, 189)
                .addComponent(btnSelEvento)
                .addContainerGap(199, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblUno)
                    .addComponent(cbxEvento, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(btnSelEvento)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        cerrar();
        getConsulta().setVisible(true);
    }//GEN-LAST:event_formWindowClosing

    private void btnSelEventoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelEventoActionPerformed
        cerrar();
        if (vent.equals("Evento")) {
            getConEvento().setVisible(true);
        }
        else {
            getConEstadisticas().setVisible(true);
        }
    }//GEN-LAST:event_btnSelEventoActionPerformed

    public void cerrar(){
        dispose();
    }
    
    public VentanaConsultas getConsulta (){
        if (consulta==null){
            consulta=new VentanaConsultas();
        }
        return consulta;
    }
    
    public VentanaConsultarEvento getConEvento (){
        if (conEvento==null){
            conEvento=new VentanaConsultarEvento();
        }
        return conEvento;
    }
    
    public VentanaEstadísticas getConEstadisticas (){
        if (conEstadisticas==null){
            conEstadisticas=new VentanaEstadísticas();
        }
        return conEstadisticas;
    }
    
    public void setVent(String vent){
        this.vent=vent;
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnSelEvento;
    private javax.swing.JComboBox cbxEvento;
    private javax.swing.JLabel lblUno;
    // End of variables declaration//GEN-END:variables
}
